UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cQyXMvg9ojt4d8PZ4ukXsdT5ZNAuiiFwcUXcnx4Es7w=' 
WHERE 
  key_id = '6da10f9826cd05207bb2e090c7d227aa7a305bc66a7c590513519a4cd083350e' 
  AND (
    token = 'cQyXMvg9ojt4d8PZ4ukXsdT5ZNAuiiFwcUXcnx4Es7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025