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

Query time 0.00064