UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oY+rjR/ERDirt0e1ygOC2gc7rUK8o3vJnoywvz5hXxQ=' 
WHERE 
  key_id = '51ce3b1e0e96226ac1a6d4baca4847c039d30ee2fca1a0ef53d8c42e23882ef5' 
  AND (
    token = 'oY+rjR/ERDirt0e1ygOC2gc7rUK8o3vJnoywvz5hXxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040