UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BaBcCHT2NfZYoJl2D28hdQg20+LNEMYdJF4PK8khl6Y=' 
WHERE 
  key_id = '7c584aa5b312b6e418b208374731fe906909bac53a44302b0a73889bf2412064' 
  AND (
    token = 'BaBcCHT2NfZYoJl2D28hdQg20+LNEMYdJF4PK8khl6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051