UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ysl/49/cOC49KMMhz8i6izFNo5MsW7iyhRcd3mWfDnE=' 
WHERE 
  key_id = '83bf4d291a4fef89bc40ecca9e05060c5ceb195463f079c10b91f7ee77aa8866' 
  AND (
    token = 'Ysl/49/cOC49KMMhz8i6izFNo5MsW7iyhRcd3mWfDnE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032