UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WcENOQc41X6IcA3dyDK60YjVZ8Xnct9QjSFe0bMTK50=' 
WHERE 
  key_id = '5257b2f084bc1dcf5877f183490d0636c951e7526993efb37d234bed36cc0aee' 
  AND (
    token = 'WcENOQc41X6IcA3dyDK60YjVZ8Xnct9QjSFe0bMTK50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030