UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OPpg2/J1HevqX5tJrEK6F6Px/FcMMUywiHY2b3Pq/D8=' 
WHERE 
  key_id = 'e8ed61faeaff3dc8980b3705a25bf0dcc17237c8fa02eea0288d501e2d4ce113' 
  AND (
    token = 'OPpg2/J1HevqX5tJrEK6F6Px/FcMMUywiHY2b3Pq/D8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040