UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0iYUTy3OfEy9xgEMNUdWhooKzjeWFeL+6HN0QRYrQGM=' 
WHERE 
  key_id = '6344c9d0b8bfe88e3594943d7c78b3da17e0f3f1dd4b4271406d04d6091540b1' 
  AND (
    token = '0iYUTy3OfEy9xgEMNUdWhooKzjeWFeL+6HN0QRYrQGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030