UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gZLfSf/n7bTY4ZqNDwmguHOg/ekXLFo3ddF2dI1XjPY=' 
WHERE 
  key_id = '9f51057580d487835242262d036ca3166bbd9830a7b99d0238a8c3b9c37ddcca' 
  AND (
    token = 'gZLfSf/n7bTY4ZqNDwmguHOg/ekXLFo3ddF2dI1XjPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030