UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LmoyJjvDNsFEDteSdRb5z9k2B/mF5usHKntCEGZy3TQ=' 
WHERE 
  key_id = '4058888ca47b0c8e1fe4983c1f2360f008702c1a2dc6a60324c7ad4745cf60a5' 
  AND (
    token = 'LmoyJjvDNsFEDteSdRb5z9k2B/mF5usHKntCEGZy3TQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050