UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PPX8xdITWKkuYFRlh29dO+ZLJzP4qhca7heIOQ5lA6g=' 
WHERE 
  key_id = '365caadd80988e347960d0a932be15811f21f08a037c657fe2d433ea35a72da3' 
  AND (
    token = 'PPX8xdITWKkuYFRlh29dO+ZLJzP4qhca7heIOQ5lA6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024