UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O7tCK+R6UY+dsYNwJmk7ICORachhoDe7SdMziz9IvGE=' 
WHERE 
  key_id = '5de6b8d4e36965654033dab4084bcf032a2a8f3fac8dd9ed45d1ca088503a981' 
  AND (
    token = 'O7tCK+R6UY+dsYNwJmk7ICORachhoDe7SdMziz9IvGE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043