UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BVQWzjh/4nIDPjLil+LAAeM4WVBiswfcUyiKAHxTVA4=' 
WHERE 
  key_id = 'ccf8ade69d904649e71fb07808b5d46574316e9878ab1e62262f6b099451b599' 
  AND (
    token = 'BVQWzjh/4nIDPjLil+LAAeM4WVBiswfcUyiKAHxTVA4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020