UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U94Jn/GBC5Z+hUW01zUPRJAD7rJVszSdy32BOfw4Eow=' 
WHERE 
  key_id = 'ad6115bc317eb44cb2d30d44916d08ab48b0bca45caa675b5d7bb862b0532de8' 
  AND (
    token = 'U94Jn/GBC5Z+hUW01zUPRJAD7rJVszSdy32BOfw4Eow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035