UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E/jA7lB5XP3aF2yTpQgyDCwScM/Ah/AEn41pHL0rNSA=' 
WHERE 
  key_id = 'bc40c80762468ef02623db876d05bbf5d9e7e9043395b57e0806be2583d84789' 
  AND (
    token = 'E/jA7lB5XP3aF2yTpQgyDCwScM/Ah/AEn41pHL0rNSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046