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

Query time 0.00032