UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w+3jqROke5aZrDZDOR2Wf/TPEP7dEP/btiTOrTcC6Dg=' 
WHERE 
  key_id = 'b27f09dcc6c5e2373b171656fab74dae405d9f7ec94587b6c363d76a51922715' 
  AND (
    token = 'w+3jqROke5aZrDZDOR2Wf/TPEP7dEP/btiTOrTcC6Dg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027