UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ufqmm9UTUlaJNrs7aNV2SP4oSjpQpUW5Wrsjzx5aBxU=' 
WHERE 
  key_id = '04fe9abfea71a19ed204f80a407d373902e492db05f640e5e264e19edb0cb806' 
  AND (
    token = 'ufqmm9UTUlaJNrs7aNV2SP4oSjpQpUW5Wrsjzx5aBxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053