UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P3rAaMwpPMczmQo7zCizis2JqHwHjkOx8Spt4uZNjLE=' 
WHERE 
  key_id = '51869003b0b7d54890110299700c42c95f12df87208cd094533481b203fcbe67' 
  AND (
    token = 'P3rAaMwpPMczmQo7zCizis2JqHwHjkOx8Spt4uZNjLE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031