UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iahYvKPxcf1Vj88D9yar2PisbRsaCuMYQCZ6KagCZFs=' 
WHERE 
  key_id = '7301b7967c835b02cafc8aee7a3f30742947ebb270e759251337f25984ca415f' 
  AND (
    token = 'iahYvKPxcf1Vj88D9yar2PisbRsaCuMYQCZ6KagCZFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034