UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ikbCq5UUAB4n9pD9uNCKN0Zt2ZjpG2baivBaIYA9IZg=' 
WHERE 
  key_id = 'd68f84cbbba40f66283222ab6cccceda5ee10df46a8cf798ce12142d55f8ca50' 
  AND (
    token = 'ikbCq5UUAB4n9pD9uNCKN0Zt2ZjpG2baivBaIYA9IZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043