UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kq5P+QZrFTvCRDGeP4hfD4XKJKac7cu6FmsChcAaKgo=' 
WHERE 
  key_id = '1171e4b073e62e5fd748b94aee78b01e52f0cf7f4c28711b47c562115b48513f' 
  AND (
    token = 'kq5P+QZrFTvCRDGeP4hfD4XKJKac7cu6FmsChcAaKgo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021