UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XZy1peaCQdsEx0zu0IpSa7RE1DPtuv3fjbIN5J07NXw=' 
WHERE 
  key_id = '6c6ae91a1bcb570e95e576ef052b78de412396b2c81426da5996fd61f905c8d6' 
  AND (
    token = 'XZy1peaCQdsEx0zu0IpSa7RE1DPtuv3fjbIN5J07NXw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044