UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X/fVj1n2EwlL7Bcvb3SUn6ZsNLPxY63ak4MNn168mrk=' 
WHERE 
  key_id = '856f7a9c19e8ea49041f468b61be9b4b1996bd40c865bcbed273bec47c15bcae' 
  AND (
    token = 'X/fVj1n2EwlL7Bcvb3SUn6ZsNLPxY63ak4MNn168mrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026