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

Query time 0.00021