UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O3xxYdm/CCyjZJQ5e3yIoK/5/pr9t1ukZMwC1c6QFyA=' 
WHERE 
  key_id = '53ffdbc5602a391004d47fd9a3870a982794b80508980df56098e7ca9b944d51' 
  AND (
    token = 'O3xxYdm/CCyjZJQ5e3yIoK/5/pr9t1ukZMwC1c6QFyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046