UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EJJzCwwh7ZZFVwFAc6NTc4ll4Y4Y+YVkoKjntjIZ/DY=' 
WHERE 
  key_id = '392c8b826991b2e82f5c3d553f71e3f91843b887c697c6b98cf4e114209106e8' 
  AND (
    token = 'EJJzCwwh7ZZFVwFAc6NTc4ll4Y4Y+YVkoKjntjIZ/DY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021