UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c+dQnfPfqM8NeCSPfw+wIShmAKO6zk1LzFxj4y5KCn4=' 
WHERE 
  key_id = 'd3c498e13b57969d373fcf935962b57e32e559aeb5d517ab872cb4cb8aea4440' 
  AND (
    token = 'c+dQnfPfqM8NeCSPfw+wIShmAKO6zk1LzFxj4y5KCn4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019