UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yjwYsTyuHhlwtzyJCP3j/DD3Bn1dLqvbrkI7HbTzGSc=' 
WHERE 
  key_id = '9cf619a9ec39b5a773c680ef06e828ccada08982a5a68499acdb686cd02bff83' 
  AND (
    token = 'yjwYsTyuHhlwtzyJCP3j/DD3Bn1dLqvbrkI7HbTzGSc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038