UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cFAOjEkX8DeolgcVt8fTGpeuw1JJLKKLuGoaWDNO9Ro=' 
WHERE 
  key_id = 'f71ae12fcf77d91edf2340231d4be8f6a633854f1772311c3759a2a5aaf77ee9' 
  AND (
    token = 'cFAOjEkX8DeolgcVt8fTGpeuw1JJLKKLuGoaWDNO9Ro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032