UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S5H4nDl0GaEuWw6HAOUmB//Mu49BRB/3zvEa6ju+qEQ=' 
WHERE 
  key_id = 'd2ade695aaf4d7c9c560913bb1debf86f872fd054c75095fdc9c757f5a1866d0' 
  AND (
    token = 'S5H4nDl0GaEuWw6HAOUmB//Mu49BRB/3zvEa6ju+qEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044