UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MSAw51NzHz2k/lUUeOmNcQRsaBxBBeokm56viiyAHJg=' 
WHERE 
  key_id = '24f40b39d34e47d2a865e4da9d9339abb6fbaec55ce9e816516e710814574433' 
  AND (
    token = 'MSAw51NzHz2k/lUUeOmNcQRsaBxBBeokm56viiyAHJg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032