UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WzaKBf/B5gB2MP7vXoxcVUBf10CoM8LPNOUSRD++rXA=' 
WHERE 
  key_id = 'd651e50ed0a309574ca5e9a1144484f4c13332ca9bb740cbdcb4e06ba1f4f207' 
  AND (
    token = 'WzaKBf/B5gB2MP7vXoxcVUBf10CoM8LPNOUSRD++rXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029