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

Query time 0.00041